package com.fxpc.hddc.hdc200.jpa.dao.primary;


import com.fxpc.hddc.hdc200.dto.primary.entity.FxqhHdc200Entity;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.time.LocalDate;
import java.util.List;


/**
 * @author zyb
 * @date 2020-11-30
 */
@Repository
public interface FxqhHdc200BaseDao extends JpaRepository<FxqhHdc200Entity, String> {

    @Query(nativeQuery = true, value = "select * from fxqh_hdc200 where SUBSTRING(create_time,1,10)= :nowDay AND is_valid = '1'")
    List<FxqhHdc200Entity> findOneDayDataByCreateTime(@Param(value = "nowDay") LocalDate nowDay);

    @Query(nativeQuery = true, value = "select * from fxqh_hdc200 where is_valid = '1'")
    List<FxqhHdc200Entity> findAllTime();

    Long count(Specification<FxqhHdc200Entity> specification);

    List<FxqhHdc200Entity> findAll(Specification<FxqhHdc200Entity> specification);


}
